#[doc = "Register `I2C_SR` reader"]
pub struct R(crate::R<I2C_SR_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<I2C_SR_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<I2C_SR_SPEC>> for R {
    fn from(reader: crate::R<I2C_SR_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "TX FIFO data completion interrupt.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_TXFIFO_OVER_A {
    #[doc = "0: No interrupt is generated."]
    NO_GENERATED = 0,
    #[doc = "1: An interrupt is generated."]
    GENERATED = 1,
}
impl From<INT_TXFIFO_OVER_A> for bool {
    #[inline(always)]
    fn from(variant: INT_TXFIFO_OVER_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `int_txfifo_over` reader - TX FIFO data completion interrupt."]
pub struct INT_TXFIFO_OVER_R(crate::FieldReader<bool, INT_TXFIFO_OVER_A>);
impl INT_TXFIFO_OVER_R {
    pub(crate) fn new(bits: bool) -> Self {
        INT_TXFIFO_OVER_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_TXFIFO_OVER_A {
        match self.bits {
            false => INT_TXFIFO_OVER_A::NO_GENERATED,
            true => INT_TXFIFO_OVER_A::GENERATED,
        }
    }
    #[doc = "Checks if the value of the field is `NO_GENERATED`"]
    #[inline(always)]
    pub fn is_no_generated(&self) -> bool {
        **self == INT_TXFIFO_OVER_A::NO_GENERATED
    }
    #[doc = "Checks if the value of the field is `GENERATED`"]
    #[inline(always)]
    pub fn is_generated(&self) -> bool {
        **self == INT_TXFIFO_OVER_A::GENERATED
    }
}
impl core::ops::Deref for INT_TXFIFO_OVER_R {
    type Target = crate::FieldReader<bool, INT_TXFIFO_OVER_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "TX FIFO overflow interrupt.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_TXTIDE_A {
    #[doc = "0: No interrupt is generated."]
    NO_GENERATED = 0,
    #[doc = "1: An interrupt is generated."]
    GENERATED = 1,
}
impl From<INT_TXTIDE_A> for bool {
    #[inline(always)]
    fn from(variant: INT_TXTIDE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `int_txtide` reader - TX FIFO overflow interrupt."]
pub struct INT_TXTIDE_R(crate::FieldReader<bool, INT_TXTIDE_A>);
impl INT_TXTIDE_R {
    pub(crate) fn new(bits: bool) -> Self {
        INT_TXTIDE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_TXTIDE_A {
        match self.bits {
            false => INT_TXTIDE_A::NO_GENERATED,
            true => INT_TXTIDE_A::GENERATED,
        }
    }
    #[doc = "Checks if the value of the field is `NO_GENERATED`"]
    #[inline(always)]
    pub fn is_no_generated(&self) -> bool {
        **self == INT_TXTIDE_A::NO_GENERATED
    }
    #[doc = "Checks if the value of the field is `GENERATED`"]
    #[inline(always)]
    pub fn is_generated(&self) -> bool {
        **self == INT_TXTIDE_A::GENERATED
    }
}
impl core::ops::Deref for INT_TXTIDE_R {
    type Target = crate::FieldReader<bool, INT_TXTIDE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "RX FIFO overflow interrupt.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_RXTIDE_A {
    #[doc = "0: No interrupt is generated."]
    NO_GENERATED = 0,
    #[doc = "1: An interrupt is generated."]
    GENERATED = 1,
}
impl From<INT_RXTIDE_A> for bool {
    #[inline(always)]
    fn from(variant: INT_RXTIDE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `int_rxtide` reader - RX FIFO overflow interrupt."]
pub struct INT_RXTIDE_R(crate::FieldReader<bool, INT_RXTIDE_A>);
impl INT_RXTIDE_R {
    pub(crate) fn new(bits: bool) -> Self {
        INT_RXTIDE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_RXTIDE_A {
        match self.bits {
            false => INT_RXTIDE_A::NO_GENERATED,
            true => INT_RXTIDE_A::GENERATED,
        }
    }
    #[doc = "Checks if the value of the field is `NO_GENERATED`"]
    #[inline(always)]
    pub fn is_no_generated(&self) -> bool {
        **self == INT_RXTIDE_A::NO_GENERATED
    }
    #[doc = "Checks if the value of the field is `GENERATED`"]
    #[inline(always)]
    pub fn is_generated(&self) -> bool {
        **self == INT_RXTIDE_A::GENERATED
    }
}
impl core::ops::Deref for INT_RXTIDE_R {
    type Target = crate::FieldReader<bool, INT_RXTIDE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Bus busy flag.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum BUS_BUSY_A {
    #[doc = "0: idle."]
    IDLE = 0,
    #[doc = "1: busy."]
    BUSY = 1,
}
impl From<BUS_BUSY_A> for bool {
    #[inline(always)]
    fn from(variant: BUS_BUSY_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `bus_busy` reader - Bus busy flag."]
pub struct BUS_BUSY_R(crate::FieldReader<bool, BUS_BUSY_A>);
impl BUS_BUSY_R {
    pub(crate) fn new(bits: bool) -> Self {
        BUS_BUSY_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> BUS_BUSY_A {
        match self.bits {
            false => BUS_BUSY_A::IDLE,
            true => BUS_BUSY_A::BUSY,
        }
    }
    #[doc = "Checks if the value of the field is `IDLE`"]
    #[inline(always)]
    pub fn is_idle(&self) -> bool {
        **self == BUS_BUSY_A::IDLE
    }
    #[doc = "Checks if the value of the field is `BUSY`"]
    #[inline(always)]
    pub fn is_busy(&self) -> bool {
        **self == BUS_BUSY_A::BUSY
    }
}
impl core::ops::Deref for BUS_BUSY_R {
    type Target = crate::FieldReader<bool, BUS_BUSY_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "TX completion interrupt for the start condition of the master.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_START_A {
    #[doc = "0: No interrupt is generated."]
    NO_GENERATED = 0,
    #[doc = "1: An interrupt is generated."]
    GENERATED = 1,
}
impl From<INT_START_A> for bool {
    #[inline(always)]
    fn from(variant: INT_START_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `int_start` reader - TX completion interrupt for the start condition of the master."]
pub struct INT_START_R(crate::FieldReader<bool, INT_START_A>);
impl INT_START_R {
    pub(crate) fn new(bits: bool) -> Self {
        INT_START_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_START_A {
        match self.bits {
            false => INT_START_A::NO_GENERATED,
            true => INT_START_A::GENERATED,
        }
    }
    #[doc = "Checks if the value of the field is `NO_GENERATED`"]
    #[inline(always)]
    pub fn is_no_generated(&self) -> bool {
        **self == INT_START_A::NO_GENERATED
    }
    #[doc = "Checks if the value of the field is `GENERATED`"]
    #[inline(always)]
    pub fn is_generated(&self) -> bool {
        **self == INT_START_A::GENERATED
    }
}
impl core::ops::Deref for INT_START_R {
    type Target = crate::FieldReader<bool, INT_START_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "TX completion interrupt for the stop condition of the master.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_STOP_A {
    #[doc = "0: No interrupt is generated."]
    NO_GENERATED = 0,
    #[doc = "1: An interrupt is generated."]
    GENERATED = 1,
}
impl From<INT_STOP_A> for bool {
    #[inline(always)]
    fn from(variant: INT_STOP_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `int_stop` reader - TX completion interrupt for the stop condition of the master."]
pub struct INT_STOP_R(crate::FieldReader<bool, INT_STOP_A>);
impl INT_STOP_R {
    pub(crate) fn new(bits: bool) -> Self {
        INT_STOP_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_STOP_A {
        match self.bits {
            false => INT_STOP_A::NO_GENERATED,
            true => INT_STOP_A::GENERATED,
        }
    }
    #[doc = "Checks if the value of the field is `NO_GENERATED`"]
    #[inline(always)]
    pub fn is_no_generated(&self) -> bool {
        **self == INT_STOP_A::NO_GENERATED
    }
    #[doc = "Checks if the value of the field is `GENERATED`"]
    #[inline(always)]
    pub fn is_generated(&self) -> bool {
        **self == INT_STOP_A::GENERATED
    }
}
impl core::ops::Deref for INT_STOP_R {
    type Target = crate::FieldReader<bool, INT_STOP_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Master TX interrupt flag.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_TX_A {
    #[doc = "0: No interrupt is generated."]
    NO_GENERATED = 0,
    #[doc = "1: An interrupt is generated."]
    GENERATED = 1,
}
impl From<INT_TX_A> for bool {
    #[inline(always)]
    fn from(variant: INT_TX_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `int_tx` reader - Master TX interrupt flag."]
pub struct INT_TX_R(crate::FieldReader<bool, INT_TX_A>);
impl INT_TX_R {
    pub(crate) fn new(bits: bool) -> Self {
        INT_TX_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_TX_A {
        match self.bits {
            false => INT_TX_A::NO_GENERATED,
            true => INT_TX_A::GENERATED,
        }
    }
    #[doc = "Checks if the value of the field is `NO_GENERATED`"]
    #[inline(always)]
    pub fn is_no_generated(&self) -> bool {
        **self == INT_TX_A::NO_GENERATED
    }
    #[doc = "Checks if the value of the field is `GENERATED`"]
    #[inline(always)]
    pub fn is_generated(&self) -> bool {
        **self == INT_TX_A::GENERATED
    }
}
impl core::ops::Deref for INT_TX_R {
    type Target = crate::FieldReader<bool, INT_TX_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Master RX interrupt flag.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_RX_A {
    #[doc = "0: No interrupt is generated."]
    NO_GENERATED = 0,
    #[doc = "1: An interrupt is generated."]
    GENERATED = 1,
}
impl From<INT_RX_A> for bool {
    #[inline(always)]
    fn from(variant: INT_RX_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `int_rx` reader - Master RX interrupt flag."]
pub struct INT_RX_R(crate::FieldReader<bool, INT_RX_A>);
impl INT_RX_R {
    pub(crate) fn new(bits: bool) -> Self {
        INT_RX_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_RX_A {
        match self.bits {
            false => INT_RX_A::NO_GENERATED,
            true => INT_RX_A::GENERATED,
        }
    }
    #[doc = "Checks if the value of the field is `NO_GENERATED`"]
    #[inline(always)]
    pub fn is_no_generated(&self) -> bool {
        **self == INT_RX_A::NO_GENERATED
    }
    #[doc = "Checks if the value of the field is `GENERATED`"]
    #[inline(always)]
    pub fn is_generated(&self) -> bool {
        **self == INT_RX_A::GENERATED
    }
}
impl core::ops::Deref for INT_RX_R {
    type Target = crate::FieldReader<bool, INT_RX_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Slave ACK error interrupt flag.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_ACK_ERR_A {
    #[doc = "0: No interrupt is generated."]
    NO_GENERATED = 0,
    #[doc = "1: An interrupt is generated."]
    GENERATED = 1,
}
impl From<INT_ACK_ERR_A> for bool {
    #[inline(always)]
    fn from(variant: INT_ACK_ERR_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `int_ack_err` reader - Slave ACK error interrupt flag."]
pub struct INT_ACK_ERR_R(crate::FieldReader<bool, INT_ACK_ERR_A>);
impl INT_ACK_ERR_R {
    pub(crate) fn new(bits: bool) -> Self {
        INT_ACK_ERR_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_ACK_ERR_A {
        match self.bits {
            false => INT_ACK_ERR_A::NO_GENERATED,
            true => INT_ACK_ERR_A::GENERATED,
        }
    }
    #[doc = "Checks if the value of the field is `NO_GENERATED`"]
    #[inline(always)]
    pub fn is_no_generated(&self) -> bool {
        **self == INT_ACK_ERR_A::NO_GENERATED
    }
    #[doc = "Checks if the value of the field is `GENERATED`"]
    #[inline(always)]
    pub fn is_generated(&self) -> bool {
        **self == INT_ACK_ERR_A::GENERATED
    }
}
impl core::ops::Deref for INT_ACK_ERR_R {
    type Target = crate::FieldReader<bool, INT_ACK_ERR_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Failure interrupt flag for the bus arbitration.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_ARB_LOSS_A {
    #[doc = "0: No interrupt is generated."]
    NO_GENERATED = 0,
    #[doc = "1: An interrupt is generated."]
    GENERATED = 1,
}
impl From<INT_ARB_LOSS_A> for bool {
    #[inline(always)]
    fn from(variant: INT_ARB_LOSS_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `int_arb_loss` reader - Failure interrupt flag for the bus arbitration."]
pub struct INT_ARB_LOSS_R(crate::FieldReader<bool, INT_ARB_LOSS_A>);
impl INT_ARB_LOSS_R {
    pub(crate) fn new(bits: bool) -> Self {
        INT_ARB_LOSS_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_ARB_LOSS_A {
        match self.bits {
            false => INT_ARB_LOSS_A::NO_GENERATED,
            true => INT_ARB_LOSS_A::GENERATED,
        }
    }
    #[doc = "Checks if the value of the field is `NO_GENERATED`"]
    #[inline(always)]
    pub fn is_no_generated(&self) -> bool {
        **self == INT_ARB_LOSS_A::NO_GENERATED
    }
    #[doc = "Checks if the value of the field is `GENERATED`"]
    #[inline(always)]
    pub fn is_generated(&self) -> bool {
        **self == INT_ARB_LOSS_A::GENERATED
    }
}
impl core::ops::Deref for INT_ARB_LOSS_R {
    type Target = crate::FieldReader<bool, INT_ARB_LOSS_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Bus transfer completion interrupt flag.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_DONE_A {
    #[doc = "0: No interrupt is generated."]
    NO_GENERATED = 0,
    #[doc = "1: An interrupt is generated."]
    GENERATED = 1,
}
impl From<INT_DONE_A> for bool {
    #[inline(always)]
    fn from(variant: INT_DONE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `int_done` reader - Bus transfer completion interrupt flag."]
pub struct INT_DONE_R(crate::FieldReader<bool, INT_DONE_A>);
impl INT_DONE_R {
    pub(crate) fn new(bits: bool) -> Self {
        INT_DONE_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_DONE_A {
        match self.bits {
            false => INT_DONE_A::NO_GENERATED,
            true => INT_DONE_A::GENERATED,
        }
    }
    #[doc = "Checks if the value of the field is `NO_GENERATED`"]
    #[inline(always)]
    pub fn is_no_generated(&self) -> bool {
        **self == INT_DONE_A::NO_GENERATED
    }
    #[doc = "Checks if the value of the field is `GENERATED`"]
    #[inline(always)]
    pub fn is_generated(&self) -> bool {
        **self == INT_DONE_A::GENERATED
    }
}
impl core::ops::Deref for INT_DONE_R {
    type Target = crate::FieldReader<bool, INT_DONE_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl R {
    #[doc = "Bit 10 - TX FIFO data completion interrupt."]
    #[inline(always)]
    pub fn int_txfifo_over(&self) -> INT_TXFIFO_OVER_R {
        INT_TXFIFO_OVER_R::new(((self.bits >> 10) & 0x01) != 0)
    }
    #[doc = "Bit 9 - TX FIFO overflow interrupt."]
    #[inline(always)]
    pub fn int_txtide(&self) -> INT_TXTIDE_R {
        INT_TXTIDE_R::new(((self.bits >> 9) & 0x01) != 0)
    }
    #[doc = "Bit 8 - RX FIFO overflow interrupt."]
    #[inline(always)]
    pub fn int_rxtide(&self) -> INT_RXTIDE_R {
        INT_RXTIDE_R::new(((self.bits >> 8) & 0x01) != 0)
    }
    #[doc = "Bit 7 - Bus busy flag."]
    #[inline(always)]
    pub fn bus_busy(&self) -> BUS_BUSY_R {
        BUS_BUSY_R::new(((self.bits >> 7) & 0x01) != 0)
    }
    #[doc = "Bit 6 - TX completion interrupt for the start condition of the master."]
    #[inline(always)]
    pub fn int_start(&self) -> INT_START_R {
        INT_START_R::new(((self.bits >> 6) & 0x01) != 0)
    }
    #[doc = "Bit 5 - TX completion interrupt for the stop condition of the master."]
    #[inline(always)]
    pub fn int_stop(&self) -> INT_STOP_R {
        INT_STOP_R::new(((self.bits >> 5) & 0x01) != 0)
    }
    #[doc = "Bit 4 - Master TX interrupt flag."]
    #[inline(always)]
    pub fn int_tx(&self) -> INT_TX_R {
        INT_TX_R::new(((self.bits >> 4) & 0x01) != 0)
    }
    #[doc = "Bit 3 - Master RX interrupt flag."]
    #[inline(always)]
    pub fn int_rx(&self) -> INT_RX_R {
        INT_RX_R::new(((self.bits >> 3) & 0x01) != 0)
    }
    #[doc = "Bit 2 - Slave ACK error interrupt flag."]
    #[inline(always)]
    pub fn int_ack_err(&self) -> INT_ACK_ERR_R {
        INT_ACK_ERR_R::new(((self.bits >> 2) & 0x01) != 0)
    }
    #[doc = "Bit 1 - Failure interrupt flag for the bus arbitration."]
    #[inline(always)]
    pub fn int_arb_loss(&self) -> INT_ARB_LOSS_R {
        INT_ARB_LOSS_R::new(((self.bits >> 1) & 0x01) != 0)
    }
    #[doc = "Bit 0 - Bus transfer completion interrupt flag."]
    #[inline(always)]
    pub fn int_done(&self) -> INT_DONE_R {
        INT_DONE_R::new((self.bits & 0x01) != 0)
    }
}
#[doc = "I2C_SR is the I2C module status register. It is used to read the operating status of the I2C module.\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [i2c_sr](index.html) module"]
pub struct I2C_SR_SPEC;
impl crate::RegisterSpec for I2C_SR_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [i2c_sr::R](R) reader structure"]
impl crate::Readable for I2C_SR_SPEC {
    type Reader = R;
}
#[doc = "`reset()` method sets I2C_SR to value 0"]
impl crate::Resettable for I2C_SR_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0
    }
}
